//package com.pingplusplus.pinus;
//
//import java.math.BigDecimal;
//import java.text.NumberFormat;
//
//import net.sourceforge.simcpux.UtilPayActivity003;
//import android.app.Activity;
//import android.os.Bundle;
//import android.text.Editable;
//import android.text.TextWatcher;
//import android.util.Log;
//import android.view.View;
//import android.widget.Button;
//import android.widget.EditText;
//
//public class PinusActivity extends Activity{
//
//    private static final String URL = "YOUR-URL";
//    private static final int REQUEST_CODE_PAYMENT = 1;
//    private static final String CHANNEL_UPMP = "upmp";
//    private static final String CHANNEL_WECHAT = "wx";
//    private static final String CHANNEL_ALIPAY = "alipay";
//
//    private EditText amountEditText;
//    private Button wechatButton;
//    
//    private String currentAmount = "1";
//
//    @Override
//    public void onCreate(Bundle savedInstanceState)
//    {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.main);
//        
//        amountEditText = (EditText) findViewById(R.id.amountEditText);
//        wechatButton = (Button) findViewById(R.id.wechatButton);
//        wechatButton.setOnClickListener(new View.OnClickListener() {			
//			@Override
//			public void onClick(View v) {
//		        String amountText = amountEditText.getText().toString();
////		        if (amountText.equals("")) return;
//
////		        String replaceable = String.format("[%s,.]", NumberFormat.getCurrencyInstance().getCurrency().getSymbol());
////		        String cleanString = amountText.toString().replaceAll(replaceable, "");
////		        int amount = Integer.valueOf(new BigDecimal(cleanString).toString());
////		    	Toast.makeText(this,"pay",Toast.LENGTH_SHORT).show();
////		    	
////		        // 支付宝，微信支付，银联按键的点击响应处理
////		        if (view.getId() == R.id.upmpButton) {
////		            new PaymentTask().execute(new PaymentRequest(CHANNEL_UPMP, amount));
////		        } else if (view.getId() == R.id.alipayButton) {
////		            new PaymentTask().execute(new PaymentRequest(CHANNEL_ALIPAY, amount));
////		        } else if (view.getId() == R.id.wechatButton) {
//		        	Log.d("003", "wechat pay");
//		        	UtilPayActivity003 u = new UtilPayActivity003(PinusActivity.this);
//		        	u.new GetAccessTokenTask(PinusActivity.this).execute();
////		        }
//				
//			}
//		});
////        alipayButton.setOnClickListener(PinusActivity.this);
////        upmpButton.setOnClickListener(PinusActivity.this);
//    
//        amountEditText.addTextChangedListener(new TextWatcher() {
//            @Override
//            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//            }
//
//            @Override
//            public void onTextChanged(CharSequence s, int start, int before, int count) {
//            }
//
//            @Override
//            public void afterTextChanged(Editable s) {
//                if (!s.toString().equals(currentAmount)) {
//                    amountEditText.removeTextChangedListener(this);
//
//                    String replaceable = String.format("[%s,.]", NumberFormat.getCurrencyInstance().getCurrency().getSymbol());
//                    String cleanString = s.toString().replaceAll(replaceable, "");
//
//                    if (new BigDecimal(cleanString).toString().equals("0")) {
//                        amountEditText.setText(null);
//                    } else {
//                        double parsed = Double.parseDouble(cleanString);
//                        String formatted = NumberFormat.getCurrencyInstance().format((parsed / 100));
//                        currentAmount = formatted;
//                        amountEditText.setText(formatted);
//                        amountEditText.setSelection(formatted.length());
//                    }
//                    amountEditText.addTextChangedListener(this);
//                }
//            }
//        });
//    }
//
//}
